# Maintainer: Ricky Wu <rickleaf.wu@gmail.com>

_realname=sqlheavy
pkgbase=mingw-w64-${_realname}
pkgname=${MINGW_PACKAGE_PREFIX}-${_realname}
pkgver=0.1.1
pkgrel=2
pkgdesc="GNOME Docking Library (mingw-w64)"
arch=('any')
license=('LGPL 2')
url="https://www.gnome.org/"
depends=("${MINGW_PACKAGE_PREFIX}-gtk2"
         "${MINGW_PACKAGE_PREFIX}-sqlite3"
         "${MINGW_PACKAGE_PREFIX}-vala"
         "${MINGW_PACKAGE_PREFIX}-libxml2")
makedepends=("intltool"
             "gtk-doc")
options=('strip' 'staticlibs')
source=(https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/${_realname}/${_realname}-${pkgver}.tar.xz
        000-libvala.patch)
sha256sums=('e8689f5fd4e0baf98eada2b3811262bb99877c2e8586fd21ad2a7ad3acc59031'
            'a2ddd76e5b4a81b1684a16c03abc2fff01a86723748b718641206b3e038a66ae')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
  patch -b -V simple -p1 -i ${srcdir}/000-libvala.patch
  autoreconf -f -i
}

build() {
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  cp -rf ../${_realname}-${pkgver}/* .

  ./configure \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX} \
    --libexecdir=${MINGW_PREFIX}/lib

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=$pkgdir install

  install -Dm644 "${srcdir}/${_realname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
